<!DOCTYPE html
		PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html lang="en" xmlns:th="http://www.thymeleaf.org">

<head>
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
	<meta name="viewport"
		  content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no">

	<title>首页</title>

	<link href="css/amazeui.css" rel="stylesheet" type="text/css" />
	<link href="css/admin.css" rel="stylesheet" type="text/css" />
	<link href="css/demo.css" rel="stylesheet" type="text/css" />
	<link href="css/hmstyle.css" rel="stylesheet" type="text/css" />
	<link href="css/skin.css" rel="stylesheet" type="text/css" />
	<link href="/css/all.css" rel="stylesheet"/>
	<link href="/css/movie/searchMovieResult.css" rel="stylesheet"/>
	<script src="/js/jquery-3.2.js"></script>
	<script src="js/jquery.min.js"></script>
	<script src="js/amazeui.min.js"></script>

</head>

<body>
<div id="container">
	<div class="hmtop">

		<!--顶部导航条 -->
		<div class="am-container header">
			<ul class="message-l">
				<div class="topMessage">
					<div class="menu-hd" v-if="isLogin" th:text="${userName}">
						{{username}},欢迎您
					</div>
				</div>
			</ul>
			<ul class="message-r">

				<div class="topMessage my-shangcheng">
					<div class="menu-hd MyShangcheng"><a href="accountSettings" target="_top"><i
							class="am-icon-user am-icon-fw"></i>个人中心</a></div>
				</div>
				<div class="topMessage mini-cart">
					<div class="menu-hd"><a id="mc-menu-hd" href="myOrderMsg" target="_top"><i
							class="am-icon-shopping-cart  am-icon-fw"></i><span>我的订单</span><strong
							id="J_MiniCartNum" class="h"></strong></a></div>
				</div>

			</ul>
		</div>

		<!--悬浮搜索框-->

		<div class="nav white">

			<div class="logoBig">
				<!--<img src="images/logo.png" style="margin-left: 0px">-->
			</div>

			<div class="search-bar pr">
				<a name="index_none_header_sysc" href="#"></a>
				<form action="/searchShop">
					<input id="searchInput" v-model="keyword" name="shopName" type="text" placeholder="搜索"
						   autocomplete="off">
					<input id="ai-topsearch" class="submit am-btn" value="搜索" index="1" type="submit" @click="toSearch">
				</form>
			</div>
		</div>

		<div class="clear"></div>

	<div class="banner">
		<!--轮播 -->
		<div class="am-slider am-slider-default scoll" data-am-flexslider id="demo-slider-0">
			<ul class="am-slides">
				<!-- <li class="banner1"><a href="introduction.html"><img src="static/images/ad1.jpg" /></a></li>
            <li class="banner2"><a><img src="static/images/ad2.jpg" /></a></li>
            <li class="banner3"><a><img src="static/images/ad3.jpg" /></a></li>
            <li class="banner4"><a><img src="static/images/ad4.jpg" /></a></li> -->
				<li v-for="(img,index) in indexImgs" :class="'banner'+(index+1)">
					<a><img :src="'images/'+img.imgUrl"></a>
				</li>
			</ul>
		</div>
		<div class="clear"></div>
	</div>
	<div class="shopNav">
		<div class="slideall">

			<div class="nav-cont">
				<ul>
					<li class="index"><a href="my">首页</a></li>
					<li class="qc"><a href="fastShop">闪购</a></li>
					<li class="qc"><a href="allGoods">限时抢</a></li>
					<li class="qc"><a href="groupShop">团购</a></li>
				</ul>

			</div>


			<div >
				<div class="search_movie_result" th:each="o:${shopGoods}">
					<div class="search_movie_result_img">
						<a href="#">
							<img th:src="'http://localhost:8011/'+${o.goodPicture}"/>
						</a>
					</div>
					<div class="search_movie_result_information">
						<div class="search_movie_result_information_1">
							<span class="search_movie_result_information_name_1">商品</span>:
							<span class="search_movie_result_information_name_2">
                            <a href="#" th:text="${o.goodname}"></a>
                        </span>
						</div>
							<div class="search_movie_result_information_1">
                                <span class="search_movie_result_information_name_1">价格</span>:
                                <span class="search_movie_result_information_name_2">
                                    <a  th:text="${o.goodprice}"></a>
                                </span>
                            </div>

							<div class="search_movie_result_information_1">
                                <span class="search_movie_result_information_cast_1">库存</span>:
                                <span class="search_movie_result_information_cast_2" th:text="${o.goodstoke}">

                                </span>
                            </div>
								<div class="search_movie_result_information_1">
                                    <span class="search_movie_result_information_name_1">抢购结束时间</span>:
                                    <span class="search_movie_result_information_name_2"
										  th:with="birthday=${o.endtime}"  th:text="${#dates.format(birthday,'yyyy-MM-dd HH:mm:ss')}
										  ">

                                    </span>
                                </div>
                                         <div class="search_movie_result_information_1">
                            <span class="search_movie_result_information_name_1"></span>
                                             <span class="search_movie_result_information_name_2">
                                                 <a  th:href="'/seckill?id='+${o.getId()}"> <button>抢购</button></a>
                                </span>
                        </div>

					</div>
				</div>
			</div>

			<!--轮播-->

			<script type="text/javascript">
				(function () {
					$('.am-slider').flexslider();  //让轮播图“动起来”
				});
				$(document).ready(function () {
					//让分类列表动起来
					$("li").hover(function () {
						$(".category-content .category-list li.first .menu-in").css("display", "none");
						$(".category-content .category-list li.first").removeClass("hover");
						$(this).addClass("hover");
						$(this).children("div.menu-in").css("display", "block")
					}, function () {
						$(this).removeClass("hover")
						$(this).children("div.menu-in").css("display", "none")
					});
				})
			</script>



			<!--小导航 -->
			<div class="am-g am-g-fixed smallnav">
				<div class="am-u-sm-3">
					<a href="sort.html"><img src="images/navsmall.jpg" />
						<div class="title">商品分类</div>
					</a>
				</div>
				<div class="am-u-sm-3">
					<a href="#"><img src="images/huismall.jpg" />
						<div class="title">大聚惠</div>
					</a>
				</div>
				<div class="am-u-sm-3">
					<a href="#"><img src="images/mansmall.jpg" />
						<div class="title">个人中心</div>
					</a>
				</div>
				<div class="am-u-sm-3">
					<a href="#"><img src="images/moneysmall.jpg" />
						<div class="title">投资理财</div>
					</a>
				</div>
			</div>

			<!--走马灯 -->


			<div class="clear"></div>
		</div>
		<script type="text/javascript">
			if ($(window).width() < 640) {
				function autoScroll(obj) {
					$(obj).find("ul").animate({
						marginTop: "-39px"
					}, 500, function () {
						$(this).css({
							marginTop: "0px"
						}).find("li:first").appendTo(this);
					})
				}
				$(function () {
					setInterval('autoScroll(".demo")', 3000);
				})
			}
		</script>
	</div>
	<div class="shopMainbg">
		<div class="shopMain" id="shopmain">

			<!--今日推荐 -->

			<div class="clear "></div>
			<!--热门活动 -->


			<div class="clear"></div>








		</div>

	</div>
	<!--引导 -->
	<div class="navCir">
		<li class="active"><a href="home.html"><i class="am-icon-home "></i>首页</a></li>
		<li><a href="sort.html"><i class="am-icon-list"></i>分类</a></li>
		<li><a href="shopcart.html"><i class="am-icon-shopping-basket"></i>购物车</a></li>
		<li><a href="person/index.html"><i class="am-icon-user"></i>我的</a></li>
	</div>




</div>


<script>
	window.jQuery || document.write('<script src="js/jquery.min.js "><\/script>');
</script>
<script type="text/javascript " src="js/quick_links.js "></script>

<script type="text/javascript" src="js/cookie_utils.js"></script>
<script type="text/javascript" src="js/vue.js"></script>
<script type="text/javascript" src="js/axios.min.js"></script>
<script type="text/javascript" src="js/base.js"></script>

<script type="text/javascript">
	var vm = new Vue({
		el: "#container",
		data: {
			username: "",
			userImg: "",
			token: "",
			isLogin: false,
			indexImgs: [],
			categories: [],
			recommends:[],
			recommendCategories:[],
			keyword:""
		},
		created: function () {
			//在页面加载之前就获取相关信息
			//1.从cookie中获取token、username、userimg
			var token = getCookieValue("token");
			if (token != null && token != "") {
				this.isLogin = true;
				this.username = getCookieValue("username");
				this.userImg = getCookieValue("userImg");
			}
			//2.轮播图显示
			var url = baseUrl + "/index/img";
			axios.get(url).then((res) => {
				var vo = res.data;
				this.indexImgs = vo.data;
				// console.log(this.indexImgs);
				//渲染轮播图
				//初始化轮播图动画效果
				setTimeout(function () {
					$('.am-slider').flexslider();
				}, 100)
			})

			//3.分类列表
			var url2 = baseUrl + "/index/category-list";
			axios({
				method: "get",
				url: url2
			}).then((res) => {
				// console.log(res.data.data);
				this.categories = res.data.data;
				//初始化分类列表的动画效果
				setTimeout(function () {
					$("li").hover(function () {
						$(".category-content .category-list li.first .menu-in").css("display", "none");
						$(".category-content .category-list li.first").removeClass("hover");
						$(this).addClass("hover");
						$(this).children("div.menu-in").css("display", "block")
					}, function () {
						$(this).removeClass("hover")
						$(this).children("div.menu-in").css("display", "none")
					});
				},100)
			})

			//4.新品推荐
			var url3 = baseUrl + "/index/recommend";
			axios.get(url3).then((res) => {
				var vo = res.data;
				// console.log(vo);
				this.recommends = vo.data;
				// console.log(this.recommends);
			})

			//5.分类商品推荐
			var url4 = baseUrl + "/index/recommend-first-level";
			axios.get(url4).then((res) => {
				// console.log(res.data.data);
				this.recommendCategories = res.data.data;
			})
		},
		methods:{
			toSearch:function(){
				var url = "search.html?keyword=" + this.keyword;
				window.location.href = encodeURI(url);
			}
		}
	})


</script>

</body>

</html>